package org.lxy.service.impl;


import cn.hutool.core.bean.BeanUtil;
import org.lxy.dao.RecycleGoodsDao;
import org.lxy.domain.RecycleGoodsEntity;
import org.lxy.service.RecycleGoodsService;
import org.lxy.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.lxy.utils.Query;

@Service
public class RecycleGoodsServiceImpl extends ServiceImpl<RecycleGoodsDao, RecycleGoodsEntity> implements RecycleGoodsService {

    @Autowired
    RecycleGoodsDao recycleGoodsDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<RecycleGoodsEntity> page = this.page(
                new Query<RecycleGoodsEntity>().getPage(params),
                new QueryWrapper<RecycleGoodsEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<RecycleGoodsEntity> queryList(RecycleGoodsEntity recycleGoodsEntity) {
        return listByMap(BeanUtil.beanToMap(recycleGoodsEntity, true, true));
    }

    @Override
    public List<RecycleGoodsEntity> queryByUserIds(List<Integer> userId) {
        return recycleGoodsDao.queryByUserIds(userId);
    }


    @Override
    public List<RecycleGoodsEntity> queryByGoodsIds(List<Integer> goodsIds) {
        return recycleGoodsDao.queryByGoodsIds(goodsIds);
    }

}